﻿using Microsoft.Xna.Framework;

namespace GameFramework.Extensions
{
    /// <summary>
    /// Rectangle extension methods.
    /// </summary>
    public static class RectangleExtensions
    {
        /// <summary>
        /// Gets the size of the rectangle (width and height) as a Vector2.
        /// </summary>
        /// <param name="rectangle">The rectangle.</param>
        /// <returns>The size of the rectangle.</returns>
        public static Vector2 GetSize(this Rectangle rectangle)
        {
            return new Vector2(rectangle.Width, rectangle.Height);
        }

        /// <summary>
        /// Returns <c>true</c> if the rectangle contains the point.
        /// </summary>
        /// <param name="rectangle">The rectangle.</param>
        /// <param name="point">The point.</param>
        /// <returns>True if the rectangle contains the point.</returns>
        public static bool Contains(this Rectangle rectangle, Vector2 point)
        {
            return rectangle.Contains((int)point.X, (int)point.Y);
        }
    }
}